{$formStart}
<input type="hidden" name="url" value="{$page.pageUrl}" />
<input type="hidden" name="numAreas" value="{$numAreas}" />
<table>
    <tr>
        <th colspan="2">{$addPageForm}</th>
    </tr>
    <tr>
        <td>{$urlLabel}</td>
        <td>{$page.pageUrl}</td>
    </tr>
    <tr>
        <td>{$themeLabel}</td>
        <td><select name="theme">
            <option value="">{$default}</option>
            {html_options values=$themes output=$themes selected=$page.settings.theme}
        </select></td>
    </tr>
    <tr>
        <td>{$pageLanguageLabel}</td>
        <td><input type="text" name="lang" value="{$page.lang}" /></td>
    </tr>
    <tr>
        <td>{$titleLabel}</td>
        <td><input type="text" name="title" value="{$page.settings.title}" /></td>
    </tr>
    <tr>
        <td>{$keywordsLabel}</td>
        <td><input type="text" name="keywords" value="{$page.settings.keywords}" /></td>
    </tr>
    <tr>
        <td>{$descriptionLabel}</td>
        <td><input type="text" name="description" value="{$page.settings.description}" /></td>
    </tr>
    <tr>
        <td>{$robotsLabel}</td>
        <td><input type="text" name="robots" value="{$page.settings.robots}" /></td>
    </tr>
    <tr>
        <td>{$authorLabel}</td>
        <td><input type="text" name="author" value="{$page.settings.author}" /></td>
    </tr>
    <tr>
        <td>{$copyrightLabel}</td>
        <td><input type="text" name="copyright" value="{$page.settings.copyright}" /></td>
    </tr>
    <tr>
        <td>{$generatorLabel}</td>
        <td><input type="text" name="generator" value="{$page.settings.generator}" /></td>
    </tr>
    <tr>
        <td>{$breadcrumb}</td>
        <td><input type="text" name="breadcrumb" value="{$page.settings.breadcrumb}" /></td>
    </tr>
    <tr>
        <td colspan="2">{$areasLabel}</td>
    </tr>
    {foreach from=$page.settings.areas key=areaName item=area name=areas}
    <tr>
        <th>{$areaNameLabel}</th>
        <th>
            {if array_search($areaName, $sections) !== false}
            <select name="area[]">{section name=sections loop=$sections}
                <option label="{$sections[sections]}" value="{$sections[sections]}"{if $sections[sections] == $areaName}
                        selected="selected"
                        {/if}>
                        {$sections[sections]}
            </option>
            {/section}</select>
            {else}
            <input name="area[]" type="text" value="{$areaName}" />
            {/if}
        </th>
    </tr>
    {section name=area loop=$area}
    <tr>
        <td>
            {if $area[area].type == 'menu' }
                {$displayMenuLabel}
            {elseif $area[area].type == 'module' }
                {$displayModuleLabel}
            {elseif $area[area].type == 'label' }
                {$displayLabelLabel}
            {elseif $area[area].type == 'template' }
                {$displayTemplateLabel}
            {/if}
        </td>
        <td>
            <input type="hidden" name="area{$smarty.foreach.areas.index}[]" value="{$area[area].type}" />
            {if $area[area].type == 'menu' }
                <input type="checkbox" checked="checked" value="1" name="area{$smarty.foreach.areas.index}menu[]" />
            {elseif $area[area].type == 'module' }
                <select name="area{$smarty.foreach.areas.index}module[]">
                <option value="">-</option>
                {html_options values=$modules output=$moduleLabels selected=$area[area].value}</select>
            {elseif $area[area].type == 'label' }
                <select name="area{$smarty.foreach.areas.index}label[]">
                <option value="">-</option>
                {html_options options=$labels selected=$area[area].value}</select>
            {elseif $area[area].type == 'template' }
                <select name="area{$smarty.foreach.areas.index}template[]">
                <option value="">-</option>
                {html_options values=$templates output=$templates selected=$area[area].value}</select>
            {/if}
        </td>
    </tr>
    {if $area[area].type == 'module'}
    <tr>
        <td>{$moduleParamsLabel}</td>
        <td><input type="text" name="area{$smarty.foreach.areas.index}moduleParam[]" value="{$area[area].param}" /></td>
    </tr>
    {/if}
    {/section}
    <tr>
        <td colspan="2">
            <a href="#" onclick="addGlobalLabel(this, {$smarty.foreach.areas.index}); return false;">{$addGlobalLabel}</a>
            <a href="#" onclick="addMenu(this, {$smarty.foreach.areas.index}); return false;">{$addMenuLabel}</a>
            <a href="#" onclick="addTemplate(this, {$smarty.foreach.areas.index}); return false;">{$addTemplateLabel}</a>
            <a href="#" onclick="addModule(this, {$smarty.foreach.areas.index}); return false;">{$addModuleLabel}</a>
        </td>
    </tr>
    {/foreach}
    <tr>
        <td colspan="2"><a href="#" onclick="addAreaRow(this); return false;">{$addRow}</a></td>
    </tr>
    <tr>
        <td colspan="2"><input type="submit" value="{$save}"></td>
    </tr>
</table>
</form>
<span id="areaNameLabel" style="display: none;">{$areaNameLabel}</span>
<span id="addGlobalLabel" style="display: none;">{$addGlobalLabel}</span>
<span id="globalLabels" style="display: none;"><select>
<option value="">-</option>
{html_options options=$labels}</select></span>
<span id="templates" style="display: none;"><select>
<option value="">-</option>
{html_options values=$templates output=$templates}</select></span>
<span id="modules" style="display: none;"><select>
<option value="">-</option>
{html_options values=$modules output=$moduleLabels}</select></span>
<span id="addMenuLabel" style="display: none;">{$addMenuLabel}</span>
<span id="addTemplateLabel" style="display: none;">{$addTemplateLabel}</span>
<span id="addModuleLabel" style="display: none;">{$addModuleLabel}</span>
<span id="displayModuleLabel" style="display: none;">{$displayModuleLabel}</span>
<span id="displayTemplateLabel" style="display: none;">{$displayTemplateLabel}</span>
<span id="displayMenuLabel" style="display: none;">{$displayMenuLabel}</span>
<span id="displayLabelLabel" style="display: none;">{$displayLabelLabel}</span>
<span id="moduleParamsLabel" style="display: none;">{$moduleParamsLabel}</span>
<span id="sections" style="display:none">
<select>{html_options output=$sections values=$sections}
<option value="">{$custom}</option></select></span>
<span id="customLabel" style="display: none">{$custom}</span>